import { Panel, PanelRow, FormModal } from 'comps/common';
import { Button, Icon } from 'antd';
import UserDevTeams from '../containers/user-dev-teams';
import UserRunnableGroups from '../containers/user-runnable-groups';
import DevTeamForm from 'comps/dev-team/containers/dev-team-form';
import RunnableGroupForm from 'comps/runnable-group/containers/runnable-group-form';
import * as React from 'react';

class MainLayer extends React.Component {
  render() {
    return (
      <div>
        <Panel title='操作'>
          <div className='btn-line'>
            <Button type='ghost' onClick={() => this.refs.devTeamModal.show()}><Icon type='code'/>创建开发组</Button>
            <Button type='ghost' onClick={() => this.refs.runnableGroupModal.show()}><Icon type='share-alt'/>创建项目</Button>
          </div>
        </Panel>
        <PanelRow>
          <UserDevTeams style={{ width: '49%' }}/>
          <UserRunnableGroups style={{ width: '49%' }}/>
        </PanelRow>
        <FormModal title='创建开发组' ref='devTeamModal' form={DevTeamForm} afterSubmit={::this.props.onListCurrentDevTeams}/>
        <FormModal title='创建开发组' ref='runnableGroupModal' form={RunnableGroupForm} afterSubmit={::this.props.onListCurrentRunnableGroup}/>
      </div>
    );
  }
}

export default MainLayer;
